from game.client.io.resource_manager import ResourceManager

#//TODO: A block can be subdivided into any granularity of sub-blocks, or be a leaf block
#a block also has volume, measured as a percentage of it's parent block
#the volume of a block


#from game.object.terrain import *

#A block is a representation of one unit in the game world.
#A block also holds references to blocks on each face, like a linked list
#To visualise the reference, the world coordinates are aligned so that
#X+ is to the right, Y+ is to the top, and Z+ is out of the screen (RHR)
#This is denoted as xp, xn, yp, yn, zp, zn
class Block:
    def __init__(self, **args):
        args.setdefault("seed",None)
        args.setdefault("terrain",None)
        args.setdefault("parent",None)
        
        self.seed = args["seed"]
        self.terrain = 0
        self.parent = args["parent"]

        self.next = None #Used mainly for rendering
        self.prev = None

        self.x = 0;
        self.y = 0;
        self.z = 0;

        r = ResourceManager()
        self.obj = r.load_terrain(0)
        
    def set_terrain(self, i):
        
        r = ResourceManager()
        self.terrain = i
        self.obj = r.load_terrain(i)



